621ec5
@@ -1714,7 +1714,17 @@
public class AssignmentManager extends ZooKeeperListener {
           if (isDisabledorDisablingRegionInRIT(region)) {
             return;
           }
-          setEnabledTable(region);
+          // In case of assignment from EnableTableHandler table state is ENABLING. Any how
+          // EnableTableHandler will set ENABLED after assigning all the table regions. If we
+          // try to set to ENABLED directly then client api may think table is enabled.
+          // When we have a case such as all the regions are added directly into .META. and we call
+          // assignRegion then we need to make the table ENABLED. Hence in such case the table
+          // will not be in ENABLING or ENABLED state.
+          String tableName = region.getTableNameAsString();
+          if (!zkTable.isEnablingTable(tableName) && !zkTable.isEnabledTable(tableName)) {
+            LOG.debug("Setting table " + tableName + " to ENABLED state.");
+            setEnabledTable(region);
+          }
         }
       }
       if (setOfflineInZK && versionOfOfflineNode == -1) {
